<template>
  <div id="test">
    <NavBar class="nav-bar">
      <div slot="item-left" class="left" @click="back()">
        <svg
          t="1661775865776"
          class="icon"
          viewBox="0 0 1024 1024"
          version="1.1"
          xmlns="http://www.w3.org/2000/svg"
          p-id="2986"
          width="15"
          height="15"
        >
          <path
            d="M393.390114 512.023536l347.948667-336.348468c20.50808-19.85828 20.50808-51.997258 0-71.792093-20.507056-19.826558-53.778834-19.826558-74.28589 0L281.990954 476.135164c-20.476357 19.826558-20.476357 51.981908 0 71.746044l385.061936 372.236839c10.285251 9.91379 23.728424 14.869662 37.173644 14.869662 13.446243 0 26.889417-4.956895 37.112246-14.901385 20.50808-19.826558 20.50808-51.919487 0-71.746044L393.390114 512.023536"
            p-id="2987"
            fill="#ffffff"
          ></path>
        </svg>
      </div>
      <div class="item-center" slot="item-center">皮卡丘售卖</div>
      <div class="item-right" slot="item-right"><div>反馈</div></div>
    </NavBar>

    <div class="center">
      <div class="title">你每周可免费玩1小时,每周三18点清零</div>
      <div class="three_block">
        <div class="free">
          <div>{{ time.free }}</div>
          <div class="item">
            剩余免费时长 <span>: </span>
            <span class="long-item">{{ time.free }}</span>
          </div>
        </div>
        <div class="line"></div>
        <div class="pay">
          <div>{{ time.pay }}</div>
          <div class="item">
            剩余付费时长 <span>: </span>
            <span class="long-item">{{ time.pay }}</span>
          </div>
        </div>
      </div>
    </div>
    <div class="product">
      <div class="active p_item" @click="tick($event)">
        <div class="hour"><span class="hour_num">3</span>小时</div>
        <div class="price">￥100</div>
      </div>
      <div class="p_item" @click="tick($event)">
        <div class="hour"><span class="hour_num">5</span>小时</div>

        <div class="price">￥600</div>
      </div>
      <div class="p_item" @click="tick($event)">
        <div class="hour"><span class="hour_num">9</span>小时</div>

        <div class="three">
          <div class="price">￥700</div>   
          <div class="price del">￥800</div>
        </div>
      </div>
    </div>
    <div class="help">
      本周还可以购买<span style="color: #d13b33">9小时</span>付费时长
    </div>
    <div class="pay_b">确认支付</div>
    <div class="agreement">
      <checkbox checked="checked"></checkbox>
      <a>同意购买协议</a>
    </div>
  </div>
</template>

<script>
import NavBar from "../../components/common/navbar/NavBar";
export default {
  name: "Test",
  components: {
    NavBar,
  },
  data() {
    return {
      active: true,
      time: {
        free: "27分钟",
        pay: "6小时30分钟",
      },
    };
  },
  methods: {
    back:function(){
        this.$router.back()
    },
    tick: function (e) {
      console.log(e.currentTarget.className);
      let classname = e.currentTarget.className;

      if (classname.indexOf("active") === 0) {
        e.currentTarget.className = "p_item";
        console.log("存在", e.currentTarget.className);
      } else {
        e.currentTarget.className = "active p_item";
        console.log("不存在", e.currentTarget.className);
      }
    },
  },
};
</script>

<style scoped>
#test {
  min-width: 360px;
}

.agreement {
  font-size: 14px;
  text-align: center;
  margin-top: 40px;
}
.item-right {
  font-size: 12px;

}
.pay_b {
  margin: 10px 13px;
  background-color: #3b4d8c;
  color: #fff;
  font-size: 20px;
  border-radius: 5px;
  text-align: center;
  height: 58px;
  line-height: 58px;
}
.help {
  color: #b1b1b1;
  font-size: 12px;
  text-align: center;
  margin-top: 5px;
}

/* 商品 */


.product {
  display: flex;
  font-weight: bold;
  padding: 12px;
}
.product .p_item {
  height: 119px;
  box-sizing: border-box;
  border: 1px solid #c5c5c5;
  border-radius: 5px;
  justify-content:space-around;
  margin-right: 14px;
  width: calc((100%-52px)/3);

  box-shadow: 0px 4px 5px #ececec;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: relative;
}

.product .active {
  border: 2px solid transparent;
  /* border-image:linear-gradient(to right, #8f41e9, #578aef) 1; */
  /* clip-path: inset(0 0 round 5px); */
  background-clip: padding-box, border-box;
  background-origin: padding-box, border-box;
  background-image: linear-gradient(to bottom right, #578aef, #8f41e9),
    linear-gradient(90deg, #578aef, #8f41e9);
  border-radius: 5px;
}

.product .p_item:last-child {
  margin-right: 0px;
}
.product .p_item div {
  box-sizing: border-box;

  text-align: center;
  flex: 50%;
}
.product .p_item .hour {
  width: 100%;
  border-radius: 5px 5px 0px 0px;
  background-color: #fff;
  padding-top: 32px;
  font-size: 26px;
  line-height: 26px;
  box-sizing: border-box;
}
.product .p_item .three{
  width: 100%;
  background-color: #fff;
  border-radius: 0px 5px 5px 5px;

}
.product .p_item .price {
  border-radius: 0px 0px 5px 5px;
  width:100%;
  background-color: #fff;
  border-radius: 0px 0px 5px 5px;
  box-sizing: border-box;
  padding-top: 17px;
  color: #6f6f6f;
  font-size: 16px;
  line-height: 16px;
}

.product .p_item div .del {
  color: #b8b8b8;
  padding-top: 0;
  text-decoration: line-through;
}
.product .p_item .hour .hour_num {
  font-size: 27px;
  /* vertical-align: middle; */
}
.nav-bar {
  background-color: #384d8c;
  color: #fff;
  box-sizing: border-box;
}
.nav-bar .left {
  line-height: 56px;
}

.item-center {
  font-size: 14px;
}

.nav-bar .right div {
  margin: 12px 0px;
  background-color: #283a73;
  width: 46px;
  height: 23px;
  line-height: 23px;
  text-align: center;
}

/* 中心 */
.center {
  margin: 0 auto;
  height: 146px;
  background-color: #fffaeb;
  box-sizing: border-box;
}

.center .title {
  text-align: center;
  color: #d69d63;
  font-size: 14px;
  padding-top: 37px;
  font-weight: bold;
  line-height: 14px;
}
.center .three_block {
  text-align: center;
  padding-top: 18px;
  display: flex;
}
.free,
.pay {
  font-size: 18px;
  color: #3e4f97;
  font-weight: bold;
  line-height: 18px;
  flex: 1;
}
.item span {
  display: none;
}
.item {
  font-size: 16px;
  line-height: 16px;
  margin-top: 10px;

  color: #a7a39b;
  font-weight: 200;
}

.three_block .line {
  width: 1px;
  height: 34px;
  border-left: 1px solid rgb(219, 215, 206);
  margin-top: 7px;
}


@media screen and (min-width: 1280px) {
  .product {
    display: flex;
    font-weight: bold;
    padding: 12px;
  }
  .product .p_item {
    height: 85px;
    box-sizing: border-box;
    border: 1px solid #c5c5c5;
    border-radius: 5px;
    /* justify-content:space-around; */
    margin-right: 13px;
    width: calc((100% - 20px)/3);
    box-shadow: 0px 4px 5px #ececec;
    display: flex;
    flex-direction:row;
    align-items: center;
  }

  .product .active {
    border: 2px solid transparent;
    /* border-image:linear-gradient(to right, #8f41e9, #578aef) 1; */
    /* clip-path: inset(0 0 round 5px); */
    background-clip: padding-box, border-box;
    background-origin: padding-box, border-box;
    background-image: linear-gradient(to bottom right, #578aef, #8f41e9),
      linear-gradient(90deg, #578aef, #8f41e9);
    border-radius: 5px;
  }

  .product .p_item:last-child {
    margin-right: 0px;
  }
  .product .p_item div {
    height:100%;
  }
  .product .p_item .hour {
    width: 100%;
    border-radius: 5px 0px 0px 5px;
    background-color: #fff;
    padding-top: 0px;
    font-size: 26px;
    line-height: 26px;
    box-sizing: border-box;
    display: flex;
    justify-content: center;
    align-items: center;
    height:100%;
    position: relative;
  }
  .product .p_item .price {
    width: 100%;
    background-color: #fff;
    border-radius: 0px 5px 5px 0px;
    box-sizing: border-box;
    padding-top: 0px;
    color: #6f6f6f;
    font-size: 16px;
    line-height: 16px;
    display: flex;
    justify-content: center;
    position: relative;
    height:100%;
    align-items: center;

  }

  .product .p_item .three{
    display: flex;
    flex-direction: row-reverse;
  }

  .product .p_item .price .del {
    color: #b8b8b8;
    padding-top: 0;
    text-decoration: line-through;
  }
  .product .p_item .hour .hour_num {
    font-size: 27px;
    /* vertical-align: middle; */
  }



  .nav-bar {
    background-color: #384d8c;
    color: #fff;
    box-sizing: border-box;
  }
  .nav-bar .left {
    line-height: 56px;
  }

  .item-center {
    font-size: 14px;
  }

  .nav-bar .right div {
    margin: 12px 0px;
    background-color: #283a73;
    width: 46px;
    height: 23px;
    line-height: 23px;
    text-align: center;
  }
}


@media screen and (min-width: 1280px) {
  .center {
    margin: 0 auto;
    height: 70px;
    background-color: #fffaeb;
    box-sizing: border-box;
  }
  .center .title {
    text-align: center;
    color: #d69d63;
    font-size: 14px;
    padding-top: 11px;
    font-weight: bold;
    line-height: 14px;
  }
  .center .three_block {
    text-align: center;
    padding-top: 12px;
    display: flex;
    font-size: 16px;
    line-height: 16px;
  }
  .free,
  .pay {
    color: #3e4f97;
    font-weight: bold;
    flex: 1;
    flex-direction: row-reverse;
  }
  .free div:nth-child(1) {
    display: none;
  }
  .pay div:nth-child(1) {
    display: none;
  }
  .item {
    color: #a7a39b;
    margin-top: 0px;
    font-weight: 200;
  }
  .free .item span {
    display: inline-block;
  }
  .pay .item span {
    display: inline-block;
  }
  .long-item {
    font-weight: bold;
    font-size: 17px;
    margin-left: 5px;
    color: #3e4f97;
  }

  .three_block .line {
    width: 1px;
    height: 22px;
    margin-top: 0px;
    border-left: 1px solid rgb(219, 215, 206);
  }

  .agreement {
  text-align: center;
  margin-top: 40px;
}
.pay_b {
  margin: 11px auto;
  background-color: #3b4d8c;
  color: #fff;
  font-size: 18px;
  border-radius: 5px;
  text-align: center;
  width:198px;
  height: 58px;
  line-height: 58px;
}
.help {
  color: #b1b1b1;
  font-size: 12px;
  text-align: center;
  margin-top: 12px;
}

}
</style>